<template>
  <van-tree-select
      v-model:active-id="activeId"
      v-model:main-active-index="activeIndex"
      :items="tagList"
      height="450px"
  />
  <div style="padding: 12px">
    <van-button block @click="doSearchResult" type="primary">确定</van-button>
  </div>
</template>

<script setup>
import {ref} from "vue";
import {Toast} from "vant";
import {useRoute, useRouter} from "vue-router";

const active = ref(0);
const onChange = (index) => Toast(`标签名 ${index + 1}`);
const activeId = ref('');
const activeIndex = ref(0);
const route = useRoute()
const router = useRouter()
//标签列表
const originTagList = [
  {
    text: '一年级',
    children: [
      {text: '数学', id: 1},
      {text: '语文', id: 2},
    ],
  },
  {
    text: '二年级',
    children: [
      {text: '数学', id: 3},
      {text: '语文', id: 4},
    ],
  },
  {
    text: '三年级',
    children: [
      {text: '数学', id: 5},
      {text: '语文', id: 6},
    ],
  },
  {
    text: '四年级',
    children: [
      {text: '数学', id: 7},
      {text: '语文', id: 8},
    ],
  },
  {
    text: '五年级',
    children: [
      {text: '数学', id: 9},
      {text: '语文', id: 10},
    ],
  },
  {
    text: '六年级',
    children: [
      {text: '数学', id: 11},
      {text: '语文', id: 12},
    ],
  },
  {
    text: '七年级',
    children: [
      {text: '数学', id: 13},
      {text: '语文', id: 14},
    ],
  },
  {
    text: '八年级',
    children: [
      {text: '数学', id: 15},
      {text: '语文', id: 16},
    ],
  },
  {
    text: '九年级',
    children: [
      {text: '数学', id1: 17},
      {text: '语文', id1: 18},
    ],
  },
];
let tagList = ref(originTagList);
const doSearchResult = ()=>{
  router.push({
    path:'/doJob/unit',
    query:{
      tags: activeId.value,
    }
  })
}
</script>

<style scoped>

</style>
